home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / Mesa-1.2.1 / include / GL / xmesa.h < prev   
Encoding:
C/C++ Source or Header  |  1995-07-05  |  4.4 KB  |  177 lines

  1. /* xmesa.h */
  2.  
  3. /*
  4.  * Mesa 3-D graphics library
  5.  * Version:  1.2
  6.  * Copyright (C) 1995  Brian Paul  (brianp@ssec.wisc.edu)
  7.  *
  8.  * This library is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU Library General Public
  10.  * License as published by the Free Software Foundation; either
  11.  * version 2 of the License, or (at your option) any later version.
  12.  *
  13.  * This library is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.  * Library General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU Library General Public
  19.  * License along with this library; if not, write to the Free
  20.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21.  */
  22.  
  23.  
  24. /*
  25. $Id: xmesa.h,v 1.6 1995/05/22 17:03:21 brianp Exp $
  26.  
  27. $Log: xmesa.h,v $
  28.  * Revision 1.6  1995/05/22  17:03:21  brianp
  29.  * Release 1.2
  30.  *
  31.  * Revision 1.5  1995/05/15  16:11:41  brianp
  32.  * added share_list argument to XMesaCreateContext()
  33.  *
  34.  * Revision 1.4  1995/04/19  13:47:56  brianp
  35.  * added XMesaGetBackBuffer()
  36.  *
  37.  * Revision 1.3  1995/04/17  14:42:32  brianp
  38.  * API changes: XMesaCreateContext, XMesaBindWindow, XMesaBindPixmap
  39.  *
  40.  * Revision 1.2  1995/03/04  19:45:47  brianp
  41.  * 1.1 beta revision
  42.  *
  43.  * Revision 1.1  1995/02/28  21:21:03  brianp
  44.  * Initial revision
  45.  *
  46.  */
  47.  
  48.  
  49. /*
  50.  * Mesa/X11 interface.  This header file serves as the documentation for
  51.  * the Mesa/X11 interface functions.
  52.  */
  53.  
  54.  
  55. /* Sample Usage:
  56.  
  57. 1. Make the X11 calls needed to open the display, select a visual, make a
  58.    colormap, open a window, etc.
  59.  
  60. 2. Call XMesaCreateContext() to create an X/Mesa rendering context.
  61.  
  62. 3. Call XMesaBindWindow() to bind the context to your window.
  63.    (or XMesaBindPixmap() to bind the context to an off-screen pixmap).
  64.  
  65. 4. Call XMesaMakeCurrent() to make the context the active one.
  66.  
  67. 5. Make gl* calls to render your graphics.
  68.  
  69. 6. Use XMesaSwapBuffers() when double buffering to update the window.
  70.  
  71. 7. When exiting, call XMesaDestroyContext().
  72.  
  73. */
  74.  
  75.  
  76.  
  77.  
  78. #ifndef XMESA_H
  79. #define XMESA_H
  80.  
  81.  
  82. #ifdef __cplusplus
  83. extern "C" {
  84. #endif
  85.  
  86.  
  87. #include <X11/Xlib.h>
  88. #include "gl.h"
  89.  
  90.  
  91. /*
  92.  * This is the XMesa context 'handle':
  93.  */
  94. typedef struct xmesa_context *XMesaContext;
  95.  
  96.  
  97.  
  98. /*
  99.  * Create a new XMesaContext for rendering into an X11 window.
  100.  *
  101.  * Input:  display - X11 display
  102.  *         window - X11 window to render into.
  103.  *         rgb_flag - GL_TRUE = RGB mode,
  104.  *                    GL_FALSE = color index mode
  105.  *         db_flag - GL_TRUE = double-buffered,
  106.  *                   GL_FALSE = single buffered
  107.  *         ximage_flag - GL_TRUE = use an XImage for back buffer,
  108.  *                       GL_FALSE = use an off-screen pixmap for back buffer
  109.  *         share_list - another XMesaContext with which to share display
  110.  *                      lists or NULL if no sharing is wanted.
  111.  * Return:  an XMesaContext or NULL if error.
  112.  */
  113. extern XMesaContext XMesaCreateContext( Display *display,
  114.                         XVisualInfo *visinfo,
  115.                         GLboolean rgb_flag,
  116.                         GLboolean db_flag,
  117.                         GLboolean ximage_flag,
  118.                         XMesaContext share_list );
  119.  
  120.  
  121. /*
  122.  * Destroy a rendering context as returned by XMesaCreateContext()
  123.  */
  124. extern void XMesaDestroyContext( XMesaContext ctx );
  125.  
  126.  
  127. /*
  128.  * Bind an X/Mesa context to an X window.
  129.  */
  130. extern GLboolean XMesaBindWindow( XMesaContext c, Window w );
  131.  
  132.  
  133. /*
  134.  * Bind an X/Mesa context to an X pixmap.
  135.  */
  136. extern GLboolean XMesaBindPixmap( XMesaContext c, Pixmap p );
  137.  
  138.  
  139. /*
  140.  * Make the specified context the current one.
  141.  */
  142. extern GLboolean XMesaMakeCurrent( XMesaContext ctx );
  143.  
  144.  
  145. /*
  146.  * Return a handle to the current context.
  147.  */
  148. extern XMesaContext XMesaGetCurrentContext( void );
  149.  
  150.  
  151. /*
  152.  * Swap the front and back buffers for the current context.  No action is
  153.  * taken if the context is not double buffered.
  154.  */
  155. extern void XMesaSwapBuffers( void );
  156.  
  157.  
  158. /*
  159.  * Return a pointer to the XMesa backbuffer Pixmap or XImage.  This function
  160.  * is a way to get "under the hood" of X/Mesa so one can manipulate the
  161.  * back buffer directly.
  162.  * Output:  pixmap - pointer to back buffer's Pixmap, or 0
  163.  *          ximage - pointer to back buffer's XImage, or NULL
  164.  * Return:  GL_TRUE = context is double buffered
  165.  *          GL_FALSE = context is single buffered
  166.  */
  167. extern GLboolean XMesaGetBackBuffer( Pixmap *pixmap, XImage **ximage );
  168.  
  169.  
  170.  
  171. #ifdef __cplusplus
  172. }
  173. #endif
  174.  
  175.  
  176. #endif
  177.